﻿#include <learn/topo/topo_builder.h>
#include <learn/topo/topo_face.h>
#include <learn/topo/topo_wire.h>

#include <stack>

using namespace xi;
using namespace xi::topo;

Topo_Face::Topo_Face() : Topo_Shape(), m_wire(nullptr)
{
}

Topo_Face::~Topo_Face()
{
    Topo_Builder builder;
    std::stack<Topo_Wire *> stack;
    while (m_wire != nullptr)
    {
        stack.push(m_wire);
        m_wire = m_wire->next();
    }

    // 自底向上删除所有 wire
    while (!stack.empty())
    {
        Topo_Wire *wire = stack.top();
        stack.pop();
        builder.remove_wire(wire);
    }
}

Topo_Wire *&Topo_Face::wire()
{
    return m_wire;
}
